import request from '@/utils/request'

const baseURL = '/sysMenu'

// 根据应用资源ID返回对应的菜单递归树
export function queryMenuTreeList (applicationId) {
  return request({
    url: `${baseURL}/queryMenuTreeList`,
    params: {
      applicationId
    }
  })
}

// 新增或更新菜单信息
export function saveOrUpdateMenu (data) {
  return request({
    url: `${baseURL}/saveOrUpdateMenu`,
    method: 'post',
    data
  })
}

// 删除菜单
export function del (id) {
  return request({
    url: `${baseURL}/delete`,
    params: {
      id
    }
  })
}

// 根据菜单路径查询应用ID
export function loadApplicationIdByMenuAddress (menuAddress) {
  return request({
    url: `${baseURL}/loadApplicationIdByMenuAddress`,
    params: {
      menuAddress
    }
  })
}
